package control;
import java.util.ArrayList;

import model.*;
import db.*;

public class CtrApartment {
	
	private DBApartment dbApart;


	public CtrApartment(){
		this.dbApart = new DBApartment();
	}
	
	public void setEmptyStatus(Apartment a){
		a.setStatus(ApartmentStatus.EMPTY);
		this.dbApart.update(a);
	}
	
	public void setRentedStatus(Apartment a){
		a.setStatus(ApartmentStatus.RENTED);
		this.dbApart.update(a);
	}
	
	public Apartment getApartment(int id){
		Apartment apartment = dbApart.getById(id);
		return apartment;
	}
	
	public ArrayList<Apartment>  getAll(){
		return this.dbApart.getAll();
	}
	public ArrayList<Apartment>  getAllWithRenters(){//added 08/01/2015
		return this.dbApart.getAllWithRenters();
	}
	
	public Apartment buildApartment(int id)
	{
		return new Apartment(id);
	}
	public ApartmentType buildApartmentType(int id)
	{
		return new ApartmentType(id);
	}
}
